#include <iostream>
#include <vector>

void push_zero(std::vector<int>& v)
{
    for(int cur = 0, des = -1; cur < v.size(); cur++)
    {
        if(v[cur])
        {
            std::swap(v[cur], v[++des]);
        }
    }
}

int main()
{
    std::vector<int> v = {1, 0, 2, 0, 9, 4, 0, 5, 6};
    push_zero(v);
    for(auto& e : v)
    {
        std::cout << e << std::endl;
    }
    return 0;
}